package cn.edu.ctbu.shiyan06.service;

import cn.edu.ctbu.shiyan06.domain.Student;
import cn.edu.ctbu.shiyan06.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {

    List<Student> findAll();

    /**
     * 只分页的查询
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);

    /**
     * 分页，带过滤的查询
     * @param student
     * @param pageable
     * @return
     */
    Page<Student>findAll(Example<Student> student,Pageable pageable);
    /**
     * 按名字进行查询，like
     *
     * @param name 字符串
     * @return
     */
    List<Student> findByNameLike(String name);
    /**
     * 按名字和密码查询
     *
     * @param name
     * @param password
     * @return
     */
    List<Student> findByNameAndPassword(String name, String password);
    Student insert(Student student);
    Student update(Student student);
    void delete(Student student);
    void delete(Integer id);
    Student getById(Integer id);
}
